package ru.onlinestore.mobile.di

import com.google.gson.Gson
import com.jakewharton.retrofit2.adapter.kotlin.coroutines.CoroutineCallAdapterFactory
import org.koin.dsl.module
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory
import ru.onlinestore.mobile.core.Constants
import ru.onlinestore.mobile.data.sources.remote.ProductsApiService

val networkModule = module {

    single {
        Retrofit.Builder().apply {
            baseUrl(Constants.ROOT_URL)
            addConverterFactory(GsonConverterFactory.create(Gson()))
            addCallAdapterFactory(CoroutineCallAdapterFactory())
        }.build().create(ProductsApiService::class.java)
    }
}